package com.aslibs.resource
{
	import com.aslibs.resource.provider.IResourceProvider;
	import com.aslibs.utils.FileUtils;
	import com.greensock.loading.LoaderMax;
	import com.greensock.loading.core.LoaderCore;
	import com.greensock.loading.core.LoaderItem;
	
	import flash.utils.Dictionary;

	public class ResourceManager
	{
		private static var _instance:ResourceManager;
		
		private var _resources:Dictionary=new Dictionary();
		private var _resourceProviders:Array=[];
		
		public function ResourceManager()
		{
			
		}
		public function get instance():ResourceManager
		{
			if(_instance==null){
				_instance=new ResourceManager();
			}
			return _instance;
		}
		public function loadResource(filename:String,resourceType:Class,onSuccess:Function=null,onFailed:Function=null,forceReload:Boolean = false):Resource
		{
			if(filename==""||filename==null){
				return;
			}
			var resource:Resource=_resources[filename];
			if(resource&&forceReload){
				_resources[filename]=null;
				delete _resources[filename];
				resource=null;
			}
			if(!resource){
				var fileExtension:String=FileUtils.extension(filename).toLocaleLowerCase();
				for each (var i:IResourceProvider in _resourceProviders) 
				{
				
				}
				
			}
		}
		public function loadResourceFromXML(xml:XML):void
		{
			
		}
		public function addEmbed(res:Class,filePath:String):void
		{
			
		}
		public function getResource(nameOrURL:String):LoaderItem
		{
			
		}
	}
}